package com.jinyi.wwdeng.ui.user.act

import android.view.Gravity
import android.view.View
import com.jinyi.wwdeng.AppConfigs
import com.jinyi.wwdeng.R
import com.jinyi.wwdeng.databinding.ActUserAccountBinding
import com.jinyi.wwdeng.pro.ProAct
import com.jinyi.wwdeng.ui.user.fragment.AccountFragment
import com.jinyi.wwdeng.ui.user.fragment.AccountFrenchFragment
import com.jinyi.wwdeng.utils.event.TrackEventType
import com.jinyi.wwdeng.utils.event.TrackEventUtils

/**
 * JinYiTest
 * @Author wwdeng
 * @CreateTime: 2024/4/24 19:56
 * @Annotation：我的账户
 */
class UserAccountAct: ProAct() {
    lateinit var binding: ActUserAccountBinding
    override fun getRootView(): View {
        binding = ActUserAccountBinding.inflate(layoutInflater)
        return binding.root
    }

    override fun initView() {
        setTitleBarVisibility(View.VISIBLE)
        setTextTitle(getString(R.string.my_loan_receiving_account))
        setTextTitleGravity(Gravity.CENTER)
        setRightBtnRes(R.mipmap.pic_kefu_black_icon)
    }

    override fun initListener() {
        //联系客服
        rootViewBinding.ivFun.setOnClickListener {
            onIntent(UserFeedbackAct::class.java)
            TrackEventUtils.logEvent(TrackEventType.CLICK.CLICK_CUSTOMER,"User Account/Wallet Page")
        }
    }

    override fun initData() {
        //根据地区显示不同的账户信息
        if(AppConfigs.isFrench()){//法语地区
            replaceContainerFragement(R.id.containerLayout, AccountFrenchFragment())
        } else {
            replaceContainerFragement(R.id.containerLayout, AccountFragment())
        }
    }

    override fun onStart() {
        super.onStart()
        TrackEventUtils.logEvent(TrackEventType.PAGE.PAGE_USER_ACCOUNT_START,"")
    }

    override fun onDestroy() {
        super.onDestroy()
        TrackEventUtils.logEvent(TrackEventType.PAGE.PAGE_USER_ACCOUNT_END,"")
    }
}